﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

using System.Web.Http.OData.Builder;
using System.Web.Http.OData.Extensions;
using WebApplication1;

namespace WebApplication1
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
            builder.EntitySet<Bacchu>("Bacchus");
            builder.EntitySet<ProductDB>("ProductDBs");
            builder.EntitySet<Company>("Companies");
            builder.EntitySet<Member>("Members");
            builder.EntitySet<Condition>("Conditions");
            builder.EntitySet<Hot6>("Hot6");
            builder.EntitySet<Material>("Materials");         
            builder.EntitySet<Company>("Companies");
            builder.EntitySet<Product_Mid>("Product_Mid");
            builder.EntitySet<ProductOut>("ProductOuts");
            builder.EntitySet<Vita500>("Vita500");
            builder.EntitySet<Worker>("Workers");
            builder.EntitySet<LotNumber>("LotNumbers");
            builder.EntitySet<Manager>("Managers");

            config.Routes.MapODataServiceRoute("odata", "odata", builder.GetEdmModel());
        }
    }
}
